package com.gitee.loyo.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 站点类型
 */
@Getter
@AllArgsConstructor
public enum StationType {
    PUBLIC(1, "公共"),
    PERSONAL(50, "个人"),
    FOR_BUS(100, "公交专用"),
    FOR_SANITATION(101, "环卫专用"),
    FOR_LOGISTICS(102, "物流专用"),
    FOR_TAXI(103, "出租车专用"),
    OTHER(255, "其他");
    private int code;
    private String text;

    public static StationType valueOf(int code){
        switch (code){
            case 1: return PUBLIC;
            case 50: return PERSONAL;
            case 100: return FOR_BUS;
            case 101: return FOR_SANITATION;
            case 102: return FOR_LOGISTICS;
            case 103: return FOR_TAXI;
            case 255: return OTHER;
        }
        throw new UnsupportedOperationException("unknown code: " + code);
    }
}
